package router

import (
	"github.com/gin-gonic/gin"

	"mxshop-api/shared/auth"
	"mxshop-api/userop-web/api/favorite"
	"mxshop-api/userop-web/global"
)

func InitFavoriteRouter(router *gin.RouterGroup) {
	signingKey := global.ServerConfig.SigningKey
	InitFavoriteRouter := router.Group("/favorite").Use(auth.Middleware(signingKey))
	{
		InitFavoriteRouter.GET("", favorite.List)                // 查看所有收藏
		InitFavoriteRouter.POST("", favorite.New)                // 新增收藏
		InitFavoriteRouter.DELETE("/:goods_id", favorite.Delete) // 取消收藏
		InitFavoriteRouter.GET("/:goods_id", favorite.Detail)    // 获取收藏明细
	}
}
